package com.ruoyi.school.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.school.domain.PacCollege;
import com.ruoyi.school.service.PacCollegeService;
import com.ruoyi.school.mapper.PacCollegeMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author jeremylin
* @description 针对表【pac_college(学院表)】的数据库操作Service实现
* @createDate 2025-11-04 05:14:20
*/
@Service
public class PacCollegeServiceImpl extends ServiceImpl<PacCollegeMapper, PacCollege>
    implements PacCollegeService{

    @Override
    public List<PacCollege> getList(PacCollege pacCollege) {
        return lambdaQuery().list();
    }

    @Override
    public PacCollege getDetails(PacCollege pacCollege) {
        if (pacCollege.getId() == null) {
            throw new RuntimeException("id不能为空");
        }
        PacCollege one = lambdaQuery().eq(PacCollege::getId, pacCollege.getId()).one();
        return one;
    }

    @Override
    public boolean add(PacCollege pacCollege) {
        if (save(pacCollege)) {
            return true;
        }
        return false;
    }

    @Override
    public boolean edit(PacCollege pacCollege) {
        if (pacCollege.getId() == null) {
            throw new RuntimeException("id不能为空");
        }
        if (updateById(pacCollege)) {
            return true;
        }
        return false;
    }

    @Override
    public boolean delete(PacCollege pacCollege) {
        if (pacCollege.getId() == null) {
            throw new RuntimeException("id不能为空");
        }
        if (removeById(pacCollege)) {
            return true;
        }
        return false;
    }

    @Override
    public List<PacCollege> getAllList(PacCollege pacCollege) {
        return lambdaQuery().list();
    }
}




